﻿using FlexFlow.Base.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FlexFlow.Runtime
{
    /// <summary>
    /// 组件设置，用来将组件与管理器关联
    /// </summary>
    public class ComponentSettings
    {
        private IUserProvider _userProvider = null;
        private IOrganizeProvider _organizeProvider = null;
        private IUserRelationProvider _userRelationProvider = null;
        private IFileDescriptionProvider _fileDescriptionProvider = null;
        private IFormTemplateProvider _formTemplateProvider = null;
        private IWorkFlowFormProvider _workflowFormProvider = null;
        private IPhysicalFileProvider _physicalFileProvider = null;
        private INotificationCatalogProvider _notificationCatalogProvider = null;
        private INotificationProvider _notificationProvider = null;
        private IProcessProvider _processProvider = null;
        private IProcessInstanceProvider _processInstanceProvider = null;
        private IActivityInstanceProvider _activityInstanceProvider = null;
        private IWorkFlowTaskProvider _workFlowTaskProvider = null;
        private IPermissionDefineProvider _permssionDefineProvider = null;
        private IUserPermissionProvider _userPermissionProvider = null;
        private IWorkFlowInformationProvider _workFlowInformationProvider = null;
        private IFlowSetpProvider _flowSetpProvider = null;

        private IOnlineUserPool _onlineUserPool = null;
        private IApplicationPool _applicationPool = null;

        /// <summary>
        /// 获取或设置关联的用户数据提供器
        /// </summary>
        public IUserProvider UserProvider
        {
            get
            {
                return _userProvider == null ? DefaultComponentSettings.UserProvider : _userProvider;
            }
            set
            {
                _userProvider = value;
            }
        }
        /// <summary>
        /// 获取或设置关联的默认组织机构数据提供其
        /// </summary>
        public IOrganizeProvider OrganizeProvider
        {
            get
            {
                return _organizeProvider == null ? DefaultComponentSettings.OrganizeProvider : _organizeProvider;
            }
            set
            {
                _organizeProvider = value;
            }
        }
        /// <summary>
        /// 获取或设置关联的用户关系数据提供器
        /// </summary>
        public IUserRelationProvider UserRelationProvider
        {
            get
            {
                return _userProvider == null ? DefaultComponentSettings.UserRelationProvider : _userRelationProvider;
            }
            set
            {
                _userRelationProvider = value;
            }
        }
        /// <summary>
        /// 获取或设置关联的文件描述提供器
        /// </summary>
        public IFileDescriptionProvider FileDescriptionProvider
        {
            get
            {
                return _fileDescriptionProvider == null ? DefaultComponentSettings.FileDescriptionProvider : _fileDescriptionProvider;
            }
            set
            {
                _fileDescriptionProvider = value;
            }
        }
        /// <summary>
        /// 获取或设置关联的的工作流表单模板提供器
        /// </summary>
        public IFormTemplateProvider FormTemplateProvider
        {
            get
            {
                return _formTemplateProvider == null ? DefaultComponentSettings.FormTemplateProvider : _formTemplateProvider;
            }
            set
            {
                _formTemplateProvider = value;
            }
        }
        /// <summary>
        /// 获取或设置关联的工作流表单提供器
        /// </summary>
        public IWorkFlowFormProvider WorkFlowFormProvider
        {
            get
            {
                return _workflowFormProvider == null ? DefaultComponentSettings.WorkFlowFormProvider : _workflowFormProvider;
            }
            set
            {
                _workflowFormProvider = value;
            }
        }
        /// <summary>
        /// 获取或设置关联的的物理文件提供器
        /// </summary>
        public IPhysicalFileProvider PhysicalFileManager
        {
            get
            {
                return _physicalFileProvider == null ? DefaultComponentSettings.PhysicalFileManager : _physicalFileProvider;
            }
            set
            {
                _physicalFileProvider = value;
            }
        }
        /// <summary>
        /// 获取或设置关联的的通知文件夹提供器
        /// </summary>
        public INotificationCatalogProvider NotificationCatalogProvider
        {
            get
            {
                return _notificationCatalogProvider == null ? DefaultComponentSettings.NotificationCatalogProvider : _notificationCatalogProvider;
            }
            set
            {
                _notificationCatalogProvider = value;
            }
        }
        /// <summary>
        /// 获取或设置关联的的通知提供器
        /// </summary>
        public INotificationProvider NotificationProvider
        {
            get
            {
                return _notificationProvider == null ? DefaultComponentSettings.NotificationProvider : _notificationProvider;
            }
            set
            {
                _notificationProvider = value;
            }
        }
        /// <summary>
        /// 获取或设置相关联的流程提供者
        /// </summary>
        public IProcessProvider ProcessProvider
        {
            get
            {
                return _processProvider == null ? DefaultComponentSettings.ProcessProvider : _processProvider;
            }
            set { _processProvider = value; }
        }
        /// <summary>
        /// 获取或设置相关联的流程实例提供者
        /// </summary>
        public IProcessInstanceProvider ProcessInstanceProvider
        {
            get
            {
                return _processInstanceProvider == null ? DefaultComponentSettings.ProcessInstanceProvider : _processInstanceProvider;
            }
            set
            {
                _processInstanceProvider = value;
            }
        }
        /// <summary>
        /// 获取或设置相关联的活动实例提供者
        /// </summary>
        public IActivityInstanceProvider ActivityInstanceProvider
        {
            get
            {
                return _activityInstanceProvider == null ? DefaultComponentSettings.ActivityInstanceProvider : _activityInstanceProvider;
            }
            set
            {
                _activityInstanceProvider = value;
            }
        }
        /// <summary>
        /// 获取或设置相关的工作流任务提供者
        /// </summary>
        public IWorkFlowTaskProvider WorkFlowTaskProvider
        {
            get
            {
                return _workflowFormProvider == null ? DefaultComponentSettings.WorkFlowTaskProvider : _workFlowTaskProvider;
            }
            set
            {
                _workFlowTaskProvider = value;
            }
        }
        /// <summary>
        /// 获取或设置相关联的权限定义提供者
        /// </summary>
        public IPermissionDefineProvider PermissionDefineProvider
        {
            get { return _permssionDefineProvider == null ? DefaultComponentSettings.PermissionDefineProvider : _permssionDefineProvider; }
            set { _permssionDefineProvider = value; }
        }
        /// <summary>
        /// 获取或设置相关联的用户权限提供者
        /// </summary>
        public IUserPermissionProvider UserPermissionProvider
        {
            get { return _userPermissionProvider == null ? DefaultComponentSettings.UserPermissionProvider : _userPermissionProvider; }
            set { _userPermissionProvider = value; }
        }
        /// <summary>
        /// 获取或设置相关联的用户权限提供者
        /// </summary>
        public IWorkFlowInformationProvider WorkFlowInformationProvider
        {
            get { return _workFlowInformationProvider == null ? DefaultComponentSettings.WorkFlowInformationProvider : _workFlowInformationProvider; }
            set { _workFlowInformationProvider = value; }
        }
        /// <summary>
        /// 获取或设置相关联的流程步骤提供者
        /// </summary>
        public IFlowSetpProvider FlowSetpProvider { 
            get { return _flowSetpProvider == null ? DefaultComponentSettings.FlowSetpProvider : _flowSetpProvider; } 
            set { this._flowSetpProvider = value; } }

        /// <summary>
        /// 获取或设置相关联的应用程序池
        /// </summary>
        public IApplicationPool ApplicationPool
        {
            get
            {
                return _applicationPool == null ? DefaultComponentSettings.ApplicationPool : _applicationPool;
            }
            set
            {
                _applicationPool = value;
            }
        }
        /// <summary>
        /// 获取或设置关联的的默认在线用户管理池
        /// </summary>
        public IOnlineUserPool OnlineUserPool
        {
            get
            {
                return _onlineUserPool == null ? DefaultComponentSettings.OnlineUserPool : _onlineUserPool;
            }
            set
            {
                _onlineUserPool = value;
            }
        }
    }
}
